home *** CD-ROM | disk | FTP | other *** search
/ Codemasters Artwork Disc ECTS 2000 ( UK) / Codemasters - Artwork Disc ECTS 2000 (UK).bin / pc / xtras / medial~1 / setfx~1.dir / Internal_131_Text List.ls < prev    next >
Encoding:
Text File  |  1998-12-01  |  1.4 KB  |  58 lines

  1. property pElementList, pFieldName, pFieldSprite, pCurActive
  2.  
  3. on new me, propList
  4.   set pElementList to getaProp(propList, #list)
  5.   set pFieldName to getaProp(propList, #textField)
  6.   set pFieldSprite to getaProp(propList, #textSprite)
  7.   set pCurActive to getaProp(propList, #cur)
  8.   if not integerp(pCurActive) then
  9.     set pCurActive to getPos(pElementList, pCurActive)
  10.   end if
  11.   populateList(me)
  12.   set the textHeight of field pFieldName to the textHeight of field pFieldName
  13.   if count(pElementList) > 0 then
  14.     SetActive(me, pCurActive)
  15.   else
  16.     SetActive(me, 0)
  17.   end if
  18.   return me
  19. end
  20.  
  21. on populateList me
  22.   set text to EMPTY
  23.   repeat with i = 1 to count(pElementList)
  24.     put string(getAt(pElementList, i)) into line i of text
  25.   end repeat
  26.   put text into field pFieldName
  27. end
  28.  
  29. on SetActive me, c
  30.   if not integer(c) then
  31.     set c to getPos(pElementList, c)
  32.   end if
  33.   if c >= 0 then
  34.     set pCurActive to c
  35.     if c = 1 then
  36.       set c1 to 1
  37.     else
  38.       set c1 to the number of chars in line 1 to c - 1 of field pFieldName + 2
  39.     end if
  40.     set c2 to the number of chars in line 1 to c of field pFieldName + 1
  41.     hilite char c1 to c2 of field pFieldName
  42.   end if
  43. end
  44.  
  45. on Drag me
  46.   repeat while the stillDown
  47.     fieldClick(me, the mouseLine)
  48.   end repeat
  49.   return pCurActive
  50. end
  51.  
  52. on fieldClick me, c
  53.   if c > count(pElementList) then
  54.     set c to count(pElementList)
  55.   end if
  56.   SetActive(me, c)
  57. end
  58.